Text Highlight
Visually emphasizes specific words or phrases within a body of text.
#Examples
#Default
The TextHighlight
component visually emphasizes specific words or phrases within a body of text by applying bold styling and a background color, guiding the user's attention and enhancing comprehension.
Is it highlight or HIGHLIGHT or inhighlighting?
return (
<TextHighlight value="Is it highlight or HIGHLIGHT or inhighlighting?" needle="highlight" />
);
#Case Sensitive
The component is case-insensitive, so the effect will be the same whether you use highlight
, HIGHLIGHT
, or inhighlighting
.
Is it highlight or HIGHLIGHT or inhighlighting?
return (
<TextHighlight
value="Is it highlight or HIGHLIGHT or inhighlighting?"
needle="highlight"
caseSensitive
/>
);
#Color Theme
Text Highlight adapts to both light and dark themes, ensuring visual contrast and readability in different contexts.
You can have light or dark theme, but not bedarkened
You can have light or dark theme, but not bedarkened
You can have light or dark theme, but not bedarkened
The light theme is the default
Check the contrast when used on custom colors
return (
<>
<ColorThemeExample backgroundColor="#000026" color={ColorWhite}>
<TextHighlight
value="You can have light or dark theme, but not bedarkened"
needle="dark"
colorTheme="dark"
/>
</ColorThemeExample>
<ColorThemeExample backgroundColor={ColorGrayDark} color={ColorGrayLighter}>
<TextHighlight
value="You can have light or dark theme, but not bedarkened"
needle="dark"
colorTheme="dark"
/>
</ColorThemeExample>
<ColorThemeExample backgroundColor={ColorGreenDarker} color={ColorGreenLighter}>
<TextHighlight
value="You can have light or dark theme, but not bedarkened"
needle="dark"
colorTheme="dark"
/>
</ColorThemeExample>
<ColorThemeExample backgroundColor={ColorWhite} color={ColorBlack}>
<TextHighlight value="The light theme is the default" needle="light" />
</ColorThemeExample>
<ColorThemeExample backgroundColor={ColorYellowLighter} color={ColorOrangeDark}>
<TextHighlight value="Check the contrast when used on custom colors" needle="contrast" />
</ColorThemeExample>
</>
);
#Properties
Is it highlight or HIGHLIGHT?
Property | Description | Defined | Value |
---|---|---|---|
needleRequired | | string | ||
valueRequired | | string | ||
caseSensitiveOptional | boolean | ||
colorThemeOptional | "dark" | "light" | ||
classNameOptional | string Custom className that's applied to the outermost element (only intended for special cases) | ||
styleOptional | object Style object to apply custom inline styles (only intended for special cases) |
#Guidelines
#Best practices
#Do not use when
#Accessibility
Explore detailed guidelines for this component: Accessibility Specifications